<template>
    <div>
      <h1>登录界面</h1>
    </div>
    <p>默认账号</p><br>
    <br>
    <div>
      <p>账户名</p><input type="text" v-model="username" placeholder="用户名" />
      <p>密码</p><input type="password" v-model="password" placeholder="密码" />
      <button @click="login">登录</button>
      <p v-if="isLoginSuccess">登录成功！</p>
      <p v-if="isLoginFailed">登录失败，请检查用户名和密码。</p>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        username: '',
        password: '',
        isLoginSuccess: false,
        isLoginFailed: false,
      };
    },
    methods: {
      login() {
        if (this.username === 'yy' && this.password === '123') {
          this.isLoginSuccess = true;
          this.isLoginFailed = false;
        } else {
          this.isLoginSuccess = false;
          this.isLoginFailed = true;
        }
      },
    },
  };
  </script>